﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApiExplorer;

namespace XieCan.Core.Swigger
{
  [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = false)]
  public class ApiRouteAttribute(ApiVersion version = ApiVersion.V1, string action = "[action]")
    : RouteAttribute($"/Api/{Enum.GetName(typeof(ApiVersion), version)}/[controller]/{action}"), IApiDescriptionGroupNameProvider
  {
    public string? GroupName { get; set; } = Enum.GetName(typeof(ApiVersion), version);
  }
}
